home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / pgm_tool / lu62 / sndb.c < prev    next >
C/C++ Source or Header  |  1995-07-03  |  3KB  |  114 lines

  1. /*
  2.  *
  3.  *             Send Block
  4.  *         s u b r o u t i n e
  5.  *
  6.  * Function : Send block to LU type 0.
  7.  * Input    : Send_Data structure.
  8.  * Output   : Return code.  
  9.  *
  10.  *
  11.  * CopyRight 1995. Nicholas Poljakov all rights reserved.
  12.  * 
  13.  */
  14. #include <stdio.h>
  15. #include <malloc.h>
  16. #include <sendat.h>
  17. #include <include.h>
  18. #include <rcb.h>
  19. #include <state1.h>
  20.  
  21. #define PRF_SIZ 31
  22.  
  23. #if OS_TYPE == 0 /* MS-DOS */
  24. int sk_r_wt(void *);
  25. int setrc(void *, void *);
  26. int sendhsf(void *);
  27. int sendhs(void *);
  28. int sendbm(void *, void *);
  29. int sendat(void *);
  30. int rtsend(void *);
  31. unsigned long rmfmh5(void *, void *);
  32. int recwait(void *);
  33. int rcvru(void *, void *);
  34. int rcvhs(void *, void *, void *, void *);
  35. int ralloc(void *, void *);
  36. int psrm(int, void *, void *);
  37. int ps_conv(int, void *);
  38. int proterr(void *, unsigned long);
  39. int preptrcv(void *, void *);
  40. int post_rcb(void *);
  41. struct repass *postopen(void *);
  42. int phsrec(void *);
  43. int pfmh5(void *);
  44. int opndst(void *);
  45. int obtsess(void *, unsigned char);
  46. int Lrf_handler(void *);
  47. int get_sess(void *, void *);
  48. int get_attr(void *);
  49. int fsm_error(unsigned char, void *);
  50. int fsm_conv(unsigned char, unsigned char, void *);
  51. int flush (void *);
  52. int dcp(void *);
  53. int dealloc(void *);
  54. int crtp(void *);
  55. int conv(void *);
  56. int chkparm(void *, void *);
  57. int check_end(unsigned int, void *);
  58. struct rqb *call_appl(void *);
  59. int buffmng(unsigned char, void *, void *, void *, unsigned, unsigned char, unsigned);
  60. unsigned long attltck(void *);
  61. unsigned long attacheck(void *);
  62. char *cgetmem(int, int);
  63. int sendhsf(void *);
  64. int opndst(void *);
  65. int alloc_rcb(void *, void *);
  66. int allocate(void *);
  67. int clsdst(void *);
  68. #endif
  69. extern short sem_no;
  70.  
  71. SendBlock(ps, p_rcb)
  72. struct send_data *ps;
  73. struct rcb *p_rcb;
  74. {
  75.         unsigned rc;
  76.         int cnt;
  77.     char *p;
  78.     struct segprf *p_sp;
  79.     struct rqb *p_rqb;
  80.  
  81.     rc = 0;
  82.         cnt = ps -> data_lt;
  83. #if OS_TYPE == 0 /* MS-DOS */
  84.         if ((p_sp = cgetmem(1, (cnt + PRF_SIZ))) == NULL) {
  85. #endif
  86. #if OS_TYPE == 1 /* Unix V */
  87.         if ((p_sp = calloc(1, (cnt + PRF_SIZ))) == NULL) {
  88. #endif
  89.            rc = 1;
  90.            goto sb_exit;
  91.         }
  92.         p = (char *)p_sp + PRF_SIZ;
  93.         memcpy(p, ps -> data_addr, cnt);
  94.         p_sp -> len = cnt + 3; /* segment length (i.e. RU + RH)*/
  95.         p_rqb = (char *)ps + 12;
  96.         p_rqb -> th.ra.rparm.parm.parm2 = Send_data;
  97.         p_rqb -> th.ra.wa.hh.hscb = p_rcb -> sess_corl;
  98.     p_rqb -> th.ra.wa.rqba.rclass = cnt;
  99.         p_rqb -> th.ra.stcb = APPL_CODE;
  100.         p_rqb -> th.ra.code = p_rqb -> th.ra.code & 0xbf; /* TOP */
  101.         p_rqb -> th.ra.wa.rqba.rsrlen = sem_no;
  102.         p_rqb -> th.ra.rparm.parm.parm1 = 1; /* Send */
  103.  
  104. #if OS_TYPE == 1  /* Unix System V */
  105.         pattach(p_rqb);
  106.         free(p_sp);
  107. #else             /* MS-DOS */
  108.         call_appl(p_rqb);
  109. #endif
  110.  
  111. sb_exit:
  112.         return rc;
  113. }
  114.